package com.zlb.leyaoxiu2.sqlite;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by Administrator on 2016/8/17.
 */
public class SQLiteHelper extends SQLiteOpenHelper {

    public static SQLiteHelper databaseHelper;

    public static SQLiteHelper getInstance(Context context) {
        if (databaseHelper == null) {
            databaseHelper = new SQLiteHelper(context.getApplicationContext());
        }
        return databaseHelper;
    }

    public SQLiteHelper(Context context) {
        super(context, "leyaoxiu.db", null, 1);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        Log.d("TEST", "hahaha");
        db.execSQL("CREATE TABLE IF NOT EXISTS test (id Integer,user_id Integer);");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int i, int i1) {
    }
}
